﻿using ENMAX_ArcGIS;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Windows;
using ESRI.ArcGIS.Client.Geometry;
using System.Windows.Media;

namespace ENMAX_ArcGIS_TestProject
{
    
    
    /// <summary>
    ///This is a test class for TwoPointScatterViewTest and is intended
    ///to contain all TwoPointScatterViewTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TwoPointScatterViewTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for RemoveTroubleTicketListFrame
        ///</summary>
        [TestMethod()]
        public void RemoveTroubleTicketListFrameTest()
        {
            TwoPointScatterView target = new TwoPointScatterView();
            TroubleTicketListFrame ttlFrame = new TroubleTicketListFrame(target, new Point(200, 250), 0);
            target.Items.Add(ttlFrame);
            TroubleTicketListFrame deleteFrame = new TroubleTicketListFrame(target, new Point(230, 300), 23);
            target.RemoveTroubleTicketListFrame(deleteFrame);
            Assert.IsTrue(target.Items.Contains(ttlFrame), "Removed the wrong TroubleTicketListFrame");
            target.RemoveTroubleTicketListFrame(ttlFrame);
            Assert.IsFalse(target.Items.Contains(ttlFrame), "Failed to remove the TroubleTicketListFrame");
        }

        /// <summary>
        ///A test for RemoveMap
        ///</summary>
        [TestMethod()]
        public void RemoveMapTest()
        {
            TwoPointScatterView target = new TwoPointScatterView();
            MapPoint mp1 = new MapPoint(1, 2);
            MapPoint mp2 = new MapPoint(3, 4);
            MapPoint mp3 = new MapPoint(5, 6);
            MapPoint mp4 = new MapPoint(7, 8);
            MapFrame newMap = new MapFrame(target, null, mp1, mp2, new SolidColorBrush(Colors.Green));
            MapFrame deleteMap = new MapFrame(target, null, mp3, mp4, new SolidColorBrush(Colors.Red));
            target.Items.Add(newMap);
            target.Items.Add(deleteMap);
            target.RemoveMap(deleteMap);
            Assert.IsTrue(target.Items.Contains(newMap));
            Assert.IsFalse(target.Items.Contains(deleteMap));
        }

        /// <summary>
        ///A test for GetMapFrame
        ///</summary>
        [TestMethod()]
        [DeploymentItem("ENMAX_ArcGIS.exe")]
        public void GetMapFrameTest()
        {
            TwoPointScatterView target = new TwoPointScatterView();
            TroubleTicket tTicket = new TroubleTicket(new MapPoint(), "Test TroubleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Envelope env1 = new Envelope(-114.15691902877, 51.0591195173411, -114.1102425907428, 51.0835361218838);
            GhostFrame gFrame = new GhostFrame(new ArcGisMap(), env1, new SolidColorBrush(Colors.Red));
            MapFrame expected = new MapFrame(target, gFrame, env1, new SolidColorBrush(Colors.Red));
            expected.RelatedTroubleTicket = tTicket;
            MapFrame actual;
            actual = target.GetMapFrame(tTicket);
            Assert.AreEqual(expected, actual, "Find MapFrame by TroubleTicket failed");
        }

        /// <summary>
        ///A test for AddTroubleTicketListFrame
        ///</summary>
        [TestMethod()]
        public void AddTroubleTicketListFrameTest()
        {
            TwoPointScatterView target = new TwoPointScatterView(); // TODO: Initialize to an appropriate value
            Point pt = new Point(100, 200); // TODO: Initialize to an appropriate value
            double orientation = 0; // TODO: Initialize to an appropriate value
            TroubleTicketListFrame ttlFrame = target.AddTroubleTicketListFrame(pt, orientation);
            Assert.IsTrue(target.Items.Contains(ttlFrame), "Creating TroubleTicketListFrame failed");
        }

        /// <summary>
        ///A test for AddSearchBox
        ///</summary>
        [TestMethod()]
        public void AddSearchBoxTest()
        {
            // Not yet implemented
        }

    }
}
